<?
	require_once "../../_func/__Global.php";
	require_once "../../_func/__Local.php";
	require_once "../../_func/__MysqlFunc.php";
	require_once "../../_func/_CodeFunc.php";

	/*JSON Type 선언 *****************************************************/
	header("Content-Type: application/json");
?>
<? /*request page에 넘길 response make : JSON response ***********************/ ?>
<?
	$resultCode = "0"; //norecord : 0, success : 200

	$type = $param->getString("type");
	$level 	= $param->getNumber("level");
	$code 	= $param->getNumber("code");
	$getall 	= $param->getNumber("getall");

	if ($type=="item")
	{
		//전체 품목
		$codedata = & Code_GetSelect('A', $level, $code,false);
	}
	else if ($type=="nitem")
	{
		//농협선택 시 품목코드
	}
	else if ($type=="fitem")
	{
		//농가선택 시 품목코드
		$codedata = & Code_GetFItemSelect($code);
	}
	else if ($type=="nfitem")
	{
		//농협선택 시 농가코드
		$codedata = & Code_GetNhFarmSelect($code);
	}
	if ($codedata->getLength() != 0)
	{
		$resultCode = "200";

		$result_array['resultCode'] = $resultCode;

		while ($codedata->hasNext())
		{
			$row = & $codedata->next();
			$resultSet[] = $row;
		}
		$result_array['resultSet'] = $resultSet;
	}
	// 결과값을 JSON 형식으로 변환한다.
	$result_array = json_encode( $result_array );
	echo $result_array;
?>
<? /*request page에 넘길 response make : JSON response ***********************/ ?>
